Skip to content

fix: skip annotation checks in instance data - #61

Closed
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/skip-annotation-instance-recursion
Closed

fix: skip annotation checks in instance data#61
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/skip-annotation-instance-recursion

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

check_annotations currently walks every object and array value in a schema. JSON Schema keywords such as default, const, examples, and enum contain instance data rather than child schemas, so payload fields named ucp_request or ucp_response inside those values can be misreported as invalid UCP annotations.

This change skips those instance-data keywords during annotation traversal while preserving validation for real schema locations. It also adds a regression test covering annotation-like field names inside default, const, examples, and enum.

Category (Required)

  • Fix
  • Test
  • Docs
  • Chore
  • CI

Related Issues

None.

Checklist

  • I have read the contribution guidelines.
  • I have added or updated tests as appropriate.
  • I have run the relevant checks locally.

Screenshots / Logs (if applicable)

  • cargo test --manifest-path /Users/bytedance/All/UCP/PR记录/worktrees/71-ucp-schema/Cargo.toml --all-targets
  • cargo clippy --manifest-path /Users/bytedance/All/UCP/PR记录/worktrees/71-ucp-schema/Cargo.toml --all-targets -- -D warnings
  • cargo fmt --manifest-path /Users/bytedance/All/UCP/PR记录/worktrees/71-ucp-schema/Cargo.toml -- --check
  • uvx pre-commit run --all-files --show-diff-on-failure
  • git diff --check

@damaz91 damaz91 added status:needs-triage Signal that the PR is ready for human triage status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 16, 2026
@igrigorik

Copy link
Copy Markdown
Contributor

Thanks @FanouZeng-TT. #66 landed this guard centrally — INSTANCE_DATA_KEYWORDS plus a shared traversal in loader.rs — and wired it into the annotation check, so ucp_* keys inside const/enum/default/examples are treated as payload rather than schema.

To be clear about scope: only the annotation check is covered. The $ref and examples variants still reproduce on main, which is why #63 and #64 stay open.

Closing this one as fixed.

@igrigorik igrigorik closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants